"use strict";

module.exports = (sequelize, DataTypes) =>
  sequelize.define(
    "author",
    {
      id: {
        type: DataTypes.BIGINT(11),
        autoIncrement: true,
        primaryKey: true,
        unique: true,
        validate: {
            isNumeric: true
        },
        commit: "The id of this database table."
      },
      parentTd: {
        type: DataTypes.BIGINT(11),
        field: 'parent_id',
        validate: {
          notNull: true,
          isNumeric: true
        },
        commit: 'The parent of this permission.'
      },
      authorName: {
        type: DataTypes.STRING,
        field: "author_name",
        validate: {
          notEmpty: true
        },
        commit: "The name of this permission."
      },
      description: {
        type: DataTypes.STRING,
        field: 'author_description',
        commit: 'The explain of this permission.'
      }
    },
    {
      underscored: true,
      timestamp: false,
      freezeTableName: true,
      tableName: "author",
      charset: "utf8",
      collate: "utf8_general_ci"
    }
  );
